package com.lefull.lefullbase.utils.OkGoHelper;

import java.util.HashMap;
import java.util.Map;


enum HTTP_METHOD {
    POST, GET
}

public class RequestModel {

    public HTTP_METHOD method = HTTP_METHOD.GET;
    public Map<String, String> parameter = new HashMap<>();
    public String baseUrl = "";
    public String url = "";
    public Map<String, String> header = new HashMap<>();
    public Boolean isCache = false;
    public ParserBaseModel parserModel;


    public RequestModel(String url, Map<String, String> parameter) {
        this.baseUrl = HTTPClientConfig.getInstance().getBaseUrl();
        this.url = url;
        this.parameter =parameter;
        this.header = HTTPClientConfig.getInstance().getHeaders();
        this.parserModel = HTTPClientConfig.getInstance().getParserBaseModel();
    }

    public static RequestModel buildGETRequest(String url,
                                               Map<String, String> parameter,
                                               Boolean isCache) {
        RequestModel requestModel = new RequestModel(url, parameter);
        requestModel.isCache = isCache;
        return requestModel;
    }

    public static RequestModel buildPOSTRequest(String url, Map<String, String> parameter) {
        RequestModel requestModel = new RequestModel(url, parameter);
        requestModel.method = HTTP_METHOD.POST;
        return requestModel;
    }



}
